package com.flk.oauth.vaildatecode;

import org.springframework.web.context.request.ServletWebRequest;

import javax.xml.bind.ValidationException;

/**
 * @author xxwy
 * on 2018/8/29 0029
 * 验证码的保存获取和移除，在两个模块中得到分开实现
 */
public interface ValidateCodeRepository {

    /**
     * 保留验证码
     * @param request
     * @param code
     * @param type
     */
    void save(ServletWebRequest request, ValidateCode code, ValidateCodeType type) throws ValidationException;

    /**
     * 获取验证码
     */
    ValidateCode get(ServletWebRequest request, ValidateCodeType type)  ;

    int getSmsNums(ServletWebRequest request, ValidateCodeType type);

    /**
     * 移除验证码
     */
    void remove(ServletWebRequest request, ValidateCodeType type);


}
